package com.kclm.xsap.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Past;


@Data
@EqualsAndHashCode(callSuper=false)
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_employee")
@Accessors(chain = true)
public class EmployeeEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@TableId
	private Long id;

	@NotBlank
	private String name;

	@NotBlank
	private String phone;

	private String sex;

	@Past(message = "至少在今天之前")
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private LocalDate birthday;

	private String introduce;

	private String avatarUrl;

	private String note;

	private String roleName;

	private String rolePassword;

	private Integer roleType;

	@NotBlank
	@Email(message = "请输入正确的邮箱格式")
	private String roleEmail;

	@TableLogic
	private Integer isDeleted;

	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@TableField(fill = FieldFill.INSERT)
	private LocalDateTime createTime;

	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private LocalDateTime lastModifyTime;

	@Version
	private Integer version = 1;

}
